package com.wc.算法基础课.B第二讲数据结构.树状数组.一个简单的整数问题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/29 20:16
 * @description https://www.acwing.com/activity/content/problem/content/9815/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static int[] a = new int[N];
    static int[] t = new int[N];
    static int n, m, l, r, d, x;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
        while (m-- > 0) {
            String q = sc.next();
            if (q.equals("C")) {
                l = sc.nextInt();
                r = sc.nextInt();
                d = sc.nextInt();
                add(l, d);
                add(r + 1, -d);
            } else {
                x = sc.nextInt();
                out.println(query(x));
            }
        }
        out.flush();
    }

    static int lowbit(int x) {
        return x & -x;
    }

    static void add(int x, int v) {
        for (int i = x; i <= n; i += lowbit(i)) {
            t[i] += v;
        }
    }

    static int query(int x) {
        int res = a[x];
        for (int i = x; i > 0; i -= lowbit(i)) {
            res += t[i];
        }
        return res;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
